<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="common/include :: header('套餐审核列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li class="select-time">
                            <label>创建时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="starttime"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="endtime"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                        <li>
                            状态：<select name="status" th:with="type=${@dict.getType('si_audit_status')}">
                            <option value="">所有</option>
                            <option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>
                        </select>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a id="startAudit" class="btn btn-warning auditBtn" onclick="startAudit()">
                <i class="fa fa-download"></i> 发起申请
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="common/include :: footer" />
<th:block th:include="common/include :: jasny-bootstrap" />

</body>
<script th:inline="javascript">
    var statusDatas = [[${@dict.getType('si_audit_status')}]];

    var prefix = ctx + "/business/leave";

    $(function() {
        var options = {
            url: prefix + "/query",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "套餐审核",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    visible: false
                },
                {
                    field: 'name',
                    title: '用户名称'
                },
                {
                    field: 'reason',
                    title: '请假原因'
                },

                {
                    field: 'starttime',
                    title: '开始时间'
                },
                {
                    field: 'endtime',
                    title: '结束时间'
                },
                {
                    field: 'auditor.userName',
                    title: '审核人'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
            ]
        };
        $.table.init(options);
    });
    $(".timerange").datetimepicker({
        format: "yyyy-mm-dd hh:mm:ii",
        autoclose: true
    });
    function startAudit(){
        // 获取勾选中的服务项进行审核
        var rows = $("#bootstrap-table").bootstrapTable('getSelections');
        var row = rows[0];
        $.modal.open("发起申请", prefix+"/startAuditPage");
    }

</script>
</html>